<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试页</title>
<link rel="stylesheet" type="text/css" href="@{'/public/stylesheets/jplayer/jplayer.blue.monday.css'}">
<link rel="stylesheet" type="text/css" href="@{'/public/javascripts/layout/themes/default/css/ueditor.min.css'}">
</head>
<body>
<div id="jplayer" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio" style="width:100%">
	<div class="jp-type-single">
		<div class="jp-gui jp-interface">
			<div class="jp-controls">
				<button class="jp-play" role="button" tabindex="0">play</button>
				<button class="jp-stop" role="button" tabindex="0">stop</button>
			</div>
			 <div class="jp-progress" style="width:50%">
				<div class="jp-seek-bar">
					<div class="jp-play-bar"></div>
				</div>
			</div>
			<div class="jp-volume-controls">
				<button class="jp-mute" role="button" tabindex="0">mute</button>
				<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
				<div class="jp-volume-bar">
					<div class="jp-volume-bar-value"></div>
				</div>
			</div>
			<div class="jp-time-holder">
				<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
				<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
			</div>
		</div>
		<div class="jp-no-solution">
			<span>Update Required</span>
			To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
		</div>
	</div>
</div>
<div style="margin-top:20px">
	<button onclick="skip(15)">前进15秒</button>
	<button onclick="skip(-15)">后退15秒</button>
	<button onclick="skipK(7025)">跳到最后</button>
	<button onclick="skipK(1805)">跳到30分5秒</button>
</div>
<script type="text/plain" id="myEditor" style="width:100%;height:400px"></script>	
</body>
<script type="text/javascript" src="@{'/public/javascripts/layout/jquery-1.8.2.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/layout/ueditor.config.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/layout/ueditor.all.min.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/layout/ueditor.parse.min.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/layout/jquery.jplayer.js'}"></script>

<script type="text/javascript">
UE.commands['insertPoint']={
		execCommand:function(data){
			this.execCommand("inserthtml","<a style='color:red;cursor:pointer'>|</a>nbsp;");
		}
	}
var ue=UE.getEditor('myEditor',{
	toolbars:[['fullscreen','source','bold','fontfamily','fontsize','italic','underline', 'fontborder', 
	           'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify','forecolor', 'backcolor','rowspacingtop', 'rowspacingbottom', 'lineheight']],
	contextMenu:[
	              {
	                  label:'标注打点(ctrl+A)',
	                  cmdName:"selectall",//显示的名称
	                  //exec可选，有了exec就会在点击时执行这个function，优先级高于cmdName
	                  exec:function () {
	                  	this.execCommand("inserthtml","<a style='color:red;cursor:pointer'>|</a>&nbsp;");
	                  }
	              }
	  ],
	  initialStyle:'body{font-size:14px;background-color:#e7e7e7;font-family:FangSong}'
});
ue.shortcutkeys.selectAll="";
ue.addshortcutkey({
	"insertPoint":"ctrl+65",
})











var player;
$(function(){
	player=$("#jplayer").jPlayer({
		swfPath:"/public/javascripts/flash/jquery.jplayer.swf",
		solution: "flash",
		supplied: "mp3",
		useStateClassSkin: true,
		autoBlur: false,
		smoothPlayBar: true,
		remainingDuration: false,
		toggleDuration: false,
		timeFormat:{
			showHour:true,
			sepHour:":",
			sepMin:":"
		},
		ready:function(){
			$("#jplayer").jPlayer("setMedia", {
//				mp3:"http://127.0.0.1:8090/test.mp3"
				mp3:"/public/filetemp/wulilun16.mp3"
			});
//			player.jPlayer("play");
		}
	}); 
})

function skip(num){
	var current=player.data("jPlayer").status.currentTime+num;
	$("#jplayer").jPlayer("play",current);
}

function skipK(num){
	$("#jplayer").jPlayer("play",num);
}

function start(){
	player.play(true);
}


function autoPlay(){
		var src = document.getElementById("test").src;
		$("#playDiv").empty();
		$("#playDiv").append("<div id='flashExample'></div>");
		try {
			$('#flashExample').flash(
						{ src: '/public/javascripts/voice/audioPlayer.swf',
							width: 0,
							height: 0,
							flashvars:{'inputFileName':src
									,"AllowScriptAccess":"always","scale":"showall"},
							wmode:'window'
						},
						{
							version: 8
						}
				 );
			} 
		catch (err) {
			alert(222)
		}
}


//var vlc = document.getElementById("vlc");
//vlc.audio.toggleMute();
//		var ue=UE.getEditor('myEditor',{
//			toolbars:[['fullscreen','source','undo','redo','bold','preview','anchor','fontfamily','fontsize']],
//			contextMenu:[
//			              {
//			                  label:'标注打点',       //显示的名称
//			                  cmdName:'selectall',//执行的command命令，当点击这个右键菜单时
//			                  //exec可选，有了exec就会在点击时执行这个function，优先级高于cmdName
//			                  exec:function () {
//			                  	this.execCommand("inserthtml","  <a href='www.baidu.com'>error</a>  ");
//			                      //this是当前编辑器的实例
//			                      //this.ui._dialogs['inserttableDialog'].open();
//			                  }
//			              }
//			  ]
//		});
		var player;
//		$(function(){
//			$("#jquery_jplayer_1").jPlayer({
//				ready: function () {
//					$(this).jPlayer("setMedia", {
//						title: "视频直播",
//						rtmpv: "rtsp://10.0.1.80:8554/mp4:test.mp4",
//						poster: "http://www.jplayer.org/video/poster/space_alone.jpg"
//					});
//					$(this).jPlayer("play")
//				},
//				swfPath: "/public/javascripts/flash/jquery.jplayer.swf",
//				supplied: "m4v,rtspv",
//				size: {
//					width: "640px",
//					height: "360px",
//					cssClass: "jp-video-360p"
//				},
//				solution: "flash, html",
//				useStateClassSkin: true,
//				autoBlur: false,
//				smoothPlayBar: true,
//				keyEnabled: true,
//				remainingDuration: true,
//				toggleDuration: true
//			});
//		})
		function pause(){
			player.jPlayer("pause");
		}
		function insert(){
			var body=ue.body;
			var parentNode=document.createElement('p');
			parentNode.setAttribute('datastr','1561');
			parentNode.style.marginLeft='20px';
			body.appendChild(parentNode);
			//第一个span
			var newNode=document.createElement('span');
			newNode.innerText="1245612";
			newNode.setAttribute('datastr','535353');
			var ttnode=body.lastChild;
			ttnode.appendChild(newNode);
			//第二个span
			var newNode=document.createElement('span');
			newNode.innerText="weaefewf";
			newNode.setAttribute('datastr','753656');
			var ttnode=body.lastChild;
			ttnode.appendChild(newNode);
			if(!$("#isScroll").is(':checked')){
				$(ue.window).scrollTop(ue.body.scrollHeight);
			}
		}
		function relace(){
			
		}
		function getRange(){
			var String=ue.selection.getText();
			alert(String)
		}
//		$(function(){
//			ue.addListener('selectionchange',function(){
//				var em=ue.selection.getRange().startContainer;
//				var node=UE.dom.domUtils.findParent(em,function(node){
//					return node.nodeName='ab';
//				})
//				if(node!=undefined){
				//	alert(node.attributes.getNameItem('class').value);
//				}
//			})
//		})
		function test(){
			alert(1111)
		}
		function rotateMe() {
		      i = 0;
		      int = setInterval(
		        function () {
		          video.style.WebkitTransform = 'rotate(' + (i++ %360) + 'deg)';
		          video.style.MozTransform = 'rotate(' + (i++ %360) + 'deg)';
		          video.style.OTransform = 'rotate(' + (i++ %360) + 'deg)';
		        }, 50);
		    }

		    function resetRotation() {
		      video.style.WebkitTransform = 'rotate(0)';
		      video.style.MozTransform = 'rotate(0)';
		      video.style.OTransform = 'rotate(0)';
		    }

		
</script>
</html>